package com.jiantong.work.impl.dao;

import com.jiantong.work.model.ButcherReportSurveyRecord;
import io.terminus.common.mysql.dao.MyBatisDao;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * Created by niufei on 2017/3/23.
 *
 */
@Repository
public class ButcherReportSurveyRecordDao extends MyBatisDao<ButcherReportSurveyRecord>{

    /**
     * 根据屠宰端的单据的id  查询政府断屠宰检疫的数据
     * @param reportId 屠宰端的单据的id
     * @return ButcherReportSurveyRecord
     */
    public ButcherReportSurveyRecord findByReport(Long reportId){
        return getSqlSession().selectOne(sqlId("findByReportId"),reportId);
    }

    /**
     * 根据单据的id  查询政府断的屠宰检疫的主键id
     * @param reportId 屠宰端的单据的id
     * @return Long id
     */
    public Long findIdByReportId(Long reportId)throws Exception{
        return getSqlSession().selectOne(sqlId("findIdByReportId"),reportId);
    }
    public List<ButcherReportSurveyRecord> findByNameOrNumber(Map criteria){
        return getSqlSession().selectList(sqlId("findByNameOrNumber"),criteria);
    }

}
